import request from "./http";

function getCourse(type,pageNum,pageSize) {

    const url ='/api/weChat/applet/course/list/type';
    const parmas = new URLSearchParams();
    parmas.append("type", type);
    parmas.append("pageNum",pageNum);
    parmas.append("pageSize", pageSize);
    // console.log(url);
    return request.post(url,parmas)
}
function getswipe(num) {
    const url =`/api/weChat/applet/course/banner/list?number=${num}`
    return request.get(url)

}
function getcourseDetail(courseId) {
    const url = `/api/pc/course/detail/${courseId}`
    return request.get(url)

}
function getfriend() {
    const url = `/api/system/dict/data/list/open?dictType=blogroll&pageNum=1&pageSize=10&orderByColumn=dictSort&isAsc=asc`;
    return request.post(url)

}
function getLogin (username,password,rememberMe=true) {
    const url =`/api/pcUser/login`;
    const parmas = new URLSearchParams();
    parmas.append("username", username);
    parmas.append("password",password);
    parmas.append("rememberMe", rememberMe);
    return request.post(url,parmas)
}
function getComment(courseId) {
    const  url=`/api/pc/comment/commentList/course/${courseId}`
    return request.get(url);
}
function getshopCar(status) {
    const url=`/api/weChat/applet/shoppingCart/my/list/?status=${status}`;
    return request.get(url)

}
function getlist() {
    const url=`/api/weChat/applet/subject/list`;
    return request.post(url,{enable:1})

}
function getaddShop(courseId) {
    const url =`/api/weChat/applet/shoppingCart/join/shoppingCart/${courseId}`;
    return request.get(url);
}
function getdelShop(shoppingCartId) {
    const url = `/api//weChat/applet/shoppingCart/remove/${shoppingCartId}`;
    return request.get(url);
}
function getuserInfo() {
    const url = `/api//pcUser/login-user/info`;
    return request.get(url);
}
function getquitLogin() {
    const url = `/api/pcUser/logout`;
    return request.get(url);
}
export {
    getCourse,
    getswipe,
    getcourseDetail,
    getfriend,
    getLogin,
    getComment,
    getshopCar,
    getlist,
    getaddShop,
    getdelShop,
    getuserInfo,
    getquitLogin
}